//////////////////////////////////////////////////////////////////////////
#include "CvInvoke.h"
//////////////////////////////////////////////////////////////////////////
#pragma once
#pragma managed
//////////////////////////////////////////////////////////////////////////
NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
public ref class ManagedNArrayIterator : public NativeHandleObject
{
public:
	ManagedNArrayIterator() : NativeHandleObject(new CvNArrayIterator(), true)
	{
	}

protected:
	virtual void ReleaseHandle() override
	{
		delete (CvNArrayIterator*)m_pHandle;
	}

internal:
	inline CvNArrayIterator* ToCvNArrayIteratorPointer()
	{
		return (CvNArrayIterator*)m_pHandle;
	}
};

public ref class ManagedGraphScanner : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvGraphScanner* pGraphScanner = this->ToCvGraphScannerPointer();
		cvReleaseGraphScanner(&pGraphScanner);
		m_pHandle = pGraphScanner;
	}

internal:
	ManagedGraphScanner(CvGraphScanner* handle, bool own) : NativeHandleObject(handle, false)
	{

	}

	inline CvGraphScanner* ToCvGraphScannerPointer()
	{
		return (CvGraphScanner*)m_pHandle;
	}
};

public ref class ManagedFont : public NativeHandleObject
{
public:
	ManagedFont() : NativeHandleObject(new CvFont(), true)
	{

	}

protected:
	virtual void ReleaseHandle() override
	{
		delete m_pHandle;
	}

internal:
	inline CvFont* ToCvFontPointer()
	{
		return (CvFont*)m_pHandle;
	}
};

public ref class ManagedTreeNodeIterator : public NativeHandleObject
{
public:
	ManagedTreeNodeIterator() : NativeHandleObject(new CvTreeNodeIterator(), true)
	{

	}

protected:
	virtual void ReleaseHandle() override
	{
		delete m_pHandle;
	}

internal:
	inline CvTreeNodeIterator* ToCvTreeNodeIteratorPointer()
	{
		return (CvTreeNodeIterator*)m_pHandle;
	}
};
//////////////////////////////////////////////////////////////////////////
NAMESPACE_END
//////////////////////////////////////////////////////////////////////////